const EntityHealper = {
    /**@param {Internal.Entity} entity*/
    getEntityLineOfSight(entity) {
        var yaw = entity.YHeadRot
        var pitch = entity.pitch
        var x = (entity.pitch == 90 || entity.pitch == -90) ? 0 : -Math.sin(yaw * PI / 180)*Math.cos(pitch * PI / 180)
        var y = entity.pitch == 90 ? -1 : entity.pitch == -90 ? 1 : -Math.sin(pitch * PI / 180)
        var z = (entity.pitch == 90 || entity.pitch == -90) ? 0 : Math.cos(yaw * PI / 180)*Math.cos(pitch * PI / 180)
        return new Vec3(x,y,z)
    },
    /**
     * @param {Internal.Entity} entity
     * @param {Number} maxLength
     * @returns {Vec3}
    */
    getEntityLookPositionOnblock(entity, maxLength) {
        var maxLength1 = Math.floor(maxLength)
        var { eyePosition } = entity
        var posVec3 = eyePosition
        for (let Length = 0; Length <= maxLength1; Length++) {
            posVec3 = posVec3.add(this.getEntityLineOfSight(entity).scale(Math.min(maxLength - Length, 1)))
            if (!entity.level.getBlockState(new BlockPos(posVec3)).isAir()) {
                return posVec3
            }
        }
        return posVec3
    }
}